Public Class CompareStringDescend
    Implements IComparer

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
        Dim d1 As String = CStr(x)
        Dim d2 As String = CStr(y)

        If d1 > d2 Then
            Return -1
        ElseIf d1 < d2 Then
            Return 1
        End If

        Return 0
    End Function
End Class

Public Class CompareDoubleDescend
    Implements IComparer

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
        Dim d1 As Double = CDbl(x)
        Dim d2 As Double = CDbl(y)

        If d1 > d2 Then
            Return -1
        ElseIf d1 < d2 Then
            Return 1
        End If

        Return 0
    End Function
End Class
